<?xml version="1.0" encoding="iso-8859-1"?>
<!DOCTYPE html 
     PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
     "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
  <title>Class: Origami::XDP::Packet::PDF</title>
  <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  <meta http-equiv="Content-Script-Type" content="text/javascript" />
  <link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
  <script type="text/javascript">
  // <![CDATA[

  function popupCode( url ) {
    window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
  }

  function toggleCode( id ) {
    if ( document.getElementById )
      elem = document.getElementById( id );
    else if ( document.all )
      elem = eval( "document.all." + id );
    else
      return false;

    elemStyle = elem.style;
    
    if ( elemStyle.display != "block" ) {
      elemStyle.display = "block"
    } else {
      elemStyle.display = "none"
    }

    return true;
  }
  
  // Make codeblocks hidden by default
  document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
  
  // ]]>
  </script>

</head>
<body>



    <div id="classHeader">
        <table class="header-table">
        <tr class="top-aligned-row">
          <td><strong>Class</strong></td>
          <td class="class-name-in-header">Origami::XDP::Packet::PDF</td>
        </tr>
        <tr class="top-aligned-row">
            <td><strong>In:</strong></td>
            <td>
                <a href="../../../../files/origami/xfa_rb.html">
                origami/xfa.rb
                </a>
        <br />
            </td>
        </tr>

        <tr class="top-aligned-row">
            <td><strong>Parent:</strong></td>
            <td>
                XFA::Element
            </td>
        </tr>
        </table>
    </div>
  <!-- banner header -->

  <div id="bodyContent">



  <div id="contextContent">

    <div id="description">
      <p>
An XDF <em>pdf</em> element encloses a <a href="PDF.html">PDF</a> packet.
</p>

    </div>


   </div>

    <div id="method-list">
      <h3 class="section-bar">Methods</h3>

      <div class="name-list">
      <a href="#M000127">enclose_pdf</a>&nbsp;&nbsp;
      <a href="#M000130">enclosed_pdf</a>&nbsp;&nbsp;
      <a href="#M000128">has_enclosed_pdf?</a>&nbsp;&nbsp;
      <a href="#M000126">new</a>&nbsp;&nbsp;
      <a href="#M000129">remove_enclosed_pdf</a>&nbsp;&nbsp;
      </div>
    </div>

  </div>


    <!-- if includes -->

    <div id="section">





      


    <!-- if method_list -->
    <div id="methods">
      <h3 class="section-bar">Public Class methods</h3>

      <div id="method-M000126" class="method-detail">
        <a name="M000126"></a>

        <div class="method-heading">
          <a href="#M000126" class="method-signature">
          <span class="method-name">new</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000126-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000126-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xfa.rb, line 822</span>
822:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">initialize</span>
823:           <span class="ruby-keyword kw">super</span>(<span class="ruby-value str">&quot;pdf&quot;</span>)
824: 
825:           <span class="ruby-identifier">add_attribute</span> <span class="ruby-value str">'xmlns'</span>, <span class="ruby-value str">'http://ns.adobe.com/xdp/pdf/'</span>
826:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <h3 class="section-bar">Public Instance methods</h3>

      <div id="method-M000127" class="method-detail">
        <a name="M000127"></a>

        <div class="method-heading">
          <a href="#M000127" class="method-signature">
          <span class="method-name">enclose_pdf</span><span class="method-args">(pdfdata)</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000127-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000127-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xfa.rb, line 828</span>
828:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">enclose_pdf</span>(<span class="ruby-identifier">pdfdata</span>)
829:           <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span>
830:           <span class="ruby-identifier">b64data</span> = <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">encode64</span>(<span class="ruby-identifier">pdfdata</span>).<span class="ruby-identifier">chomp!</span>
831:          
832:           <span class="ruby-identifier">doc</span> = <span class="ruby-identifier">elements</span>[<span class="ruby-value str">'document'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">add_element</span>(<span class="ruby-value str">'document'</span>)
833:           <span class="ruby-identifier">chunk</span> = <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">elements</span>[<span class="ruby-value str">'chunk'</span>] <span class="ruby-operator">||</span> <span class="ruby-identifier">doc</span>.<span class="ruby-identifier">add_element</span>(<span class="ruby-value str">'chunk'</span>)
834: 
835:           <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">text</span> = <span class="ruby-identifier">b64data</span>
836: 
837:           <span class="ruby-keyword kw">self</span>
838:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000130" class="method-detail">
        <a name="M000130"></a>

        <div class="method-heading">
          <a href="#M000130" class="method-signature">
          <span class="method-name">enclosed_pdf</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000130-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000130-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xfa.rb, line 850</span>
850:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">enclosed_pdf</span>
851:           <span class="ruby-keyword kw">return</span> <span class="ruby-keyword kw">nil</span> <span class="ruby-keyword kw">unless</span> <span class="ruby-identifier">has_enclosed_pdf?</span>
852: 
853:           <span class="ruby-identifier">require</span> <span class="ruby-value str">'base64'</span>
854:           <span class="ruby-constant">Base64</span>.<span class="ruby-identifier">decode64</span>(<span class="ruby-identifier">elements</span>[<span class="ruby-value str">'document/chunk'</span>].<span class="ruby-identifier">text</span>)
855:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000128" class="method-detail">
        <a name="M000128"></a>

        <div class="method-heading">
          <a href="#M000128" class="method-signature">
          <span class="method-name">has_enclosed_pdf?</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000128-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000128-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xfa.rb, line 840</span>
840:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">has_enclosed_pdf?</span>
841:           <span class="ruby-identifier">chunk</span> = <span class="ruby-identifier">elements</span>[<span class="ruby-value str">'document/chunk'</span>]
842: 
843:           <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">nil?</span> <span class="ruby-keyword kw">and</span> <span class="ruby-keyword kw">not</span> <span class="ruby-identifier">chunk</span>.<span class="ruby-identifier">text</span>.<span class="ruby-identifier">nil?</span>
844:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>

      <div id="method-M000129" class="method-detail">
        <a name="M000129"></a>

        <div class="method-heading">
          <a href="#M000129" class="method-signature">
          <span class="method-name">remove_enclosed_pdf</span><span class="method-args">()</span>
          </a>
        </div>
      
        <div class="method-description">
          <p><a class="source-toggle" href="#"
            onclick="toggleCode('M000129-source');return false;">[Source]</a></p>
          <div class="method-source-code" id="M000129-source">
<pre>
     <span class="ruby-comment cmt"># File origami/xfa.rb, line 846</span>
846:         <span class="ruby-keyword kw">def</span> <span class="ruby-identifier">remove_enclosed_pdf</span>
847:           <span class="ruby-identifier">elements</span>.<span class="ruby-identifier">delete</span>(<span class="ruby-value str">'document'</span>) <span class="ruby-keyword kw">if</span> <span class="ruby-identifier">has_enclosed_pdf?</span>
848:         <span class="ruby-keyword kw">end</span>
</pre>
          </div>
        </div>
      </div>


    </div>


  </div>


<div id="validator-badges">
  <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
</div>

</body>
</html>